package com.group3.domain;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.group3.controller.Validated.Add;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Null;
import java.util.Date;

@Data
@ToString
@ApiModel(value = "课程详情")
public class Lesson {

    @ApiModelProperty(value = "排课id")
    @NotBlank(message = "排课id不能为空", groups = Add.class)
    private Integer lessonId;

    @ApiModelProperty(value = "课程名")
    @NotBlank(message = "课程名不能为空", groups = Add.class)
    private String lessonName;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "上课时间（某一天）")
    private Date date;

    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "应签到时间")
    private Date startTime;

    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(value = "应签退时间")
    private Date endTime;

    @ApiModelProperty(value = "教室名")
    @NotBlank(message = "教室名不能为空", groups = Add.class)
    private String classRoom;

    @ApiModelProperty(value = "备注")
    private String remark;

    @NotBlank(message = "责任教师不能为空", groups = Add.class)
    @ApiModelProperty(value = "责任教师id")
    private String teacherId;

    @ApiModelProperty(value = "状态")
    @Null(message = "不能加状态！", groups = Add.class)
    private Integer state;

    @ApiModelProperty(value = "状态")
    @Null(message = "不能加状态！", groups = Add.class)
    private String stateStr;

    public String getStateStr() {
        switch (state) {
//            0-使用；1-已有记录，逻辑删除；-1只是课程名
            case 0:
                return "使用";
            case 1:
                return "已有记录，逻辑删除";
            case -1:
                return "只是课程名";
        }
        return "?";
    }

}